﻿using DevExpress.Xpf.Core;
using System.Windows;
using TeBigScreen.Common;

namespace TeBigScreenWpf
{
    /// <summary>
    /// Interaction logic for LoginWindow.xaml
    /// </summary>
    public partial class LoginWindow : ThemedWindow
    {
        public LoginWindow()
        {
            InitializeComponent();

            check_left.IsChecked = Config.Default.Login.Left;
            check_main.IsChecked = Config.Default.Login.Main;
            check_right.IsChecked = Config.Default.Login.Right;
        }

        private void Button_OK_Click(object sender, RoutedEventArgs e)
        {
            bool left = check_left.IsChecked.HasValue && check_left.IsChecked.Value;
            bool main = check_main.IsChecked.HasValue && check_main.IsChecked.Value;
            bool right = check_right.IsChecked.HasValue && check_right.IsChecked.Value;

            if (left || main || right)
            {
                Config.Default.Login.Left = left;
                Config.Default.Login.Main = main;
                Config.Default.Login.Right = right;
                Config.Default.SaveConfig();

                var w = new MainWindow(left, main, right);

                w.Show();
                this.Close();
            }
        }

        private void Button_Cancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}